import React from 'react';

import { Tabs } from 'antd';
import queryString from 'query-string';
import WrappedIframe from './iframeA';
import HtmlData from './htmldata';
import { AppleOutlined, AndroidOutlined } from '@ant-design/icons';
import request from "../../../commons/utils/request";
import { processData, Error } from "../../../commons/utils";
import 'antd/dist/antd.css';
const { TabPane } = Tabs;
class Flowcenter extends React.Component{
  constructor(props) {
    super(props);
  }
  //
  task1 = (key) =>{
    console.log(key);
  }
  task2 = () =>{
    return new Promise((resolve, reject) => {
      let sino = parseInt(Math.random() * 6 + 1)
      setTimeout(() => {
        resolve(sino)
      }, 3000)
    })
  }

  task3 = async()=>{
    let n = await this.task2();
    console.log(n);
  }

  async componentDidMount(){
    let url = "http://dev.imp.pub.caep/pap-caep-extfe/Approval/#/jump?acUrlType=redirect&pkBo=30b0b4d3811d49db8d276e0278cb0b3d&pkBoins=30b0b4d3811d49db8d276e0278cb0b3d&taskId=8acd3d87-a977-11ea-a7c7-26994663328d&processDefId=processcenter_0d0c22cf:2:c32834d0-a65e-11ea-8450-6e8bb6be2b6f&processDefinitionId=processcenter_0d0c22cf:2:c32834d0-a65e-11ea-8450-6e8bb6be2b6f&formId=30b0b4d3811d49db8d276e0278cb0b3d&formInstanceId=30b0b4d3811d49db8d276e0278cb0b3d&processInstId=8ac1f2c8-a977-11ea-a7c7-26994663328d&page=iformBrowse&systype=approvecenter&id=8acd3d87-a977-11ea-a7c7-26994663328d&formKey=null&businessKey=30b0b4d3811d49db8d276e0278cb0b3d&activityId=approveUserTask_ddc7ff5a31e74bb5a3254e95f3d46682&taskId=8acd3d87-a977-11ea-a7c7-26994663328d&processInstanceId=8ac1f2c8-a977-11ea-a7c7-26994663328d&taskFlag=todo&typecode=approve&tenantId=wnubbh0f&source=CNPF&dealFaceApprove=false";
    let searchObj = queryString.parse(url);
    let { businessKey, taskId, callbackurl, taskFlag, processInstanceId } = searchObj;
    
  }
  render(){
    return(
      <Tabs defaultActiveKey="1">
        <TabPane
          tab={
            <span>
              <AppleOutlined />
          Tab 1
        </span>
          }
          key="1"
        >
          <WrappedIframe/>
    </TabPane>
        <TabPane
          tab={
            <span>
              <AndroidOutlined />
          Tab 2
        </span>
          }
          key="2"
        >
          <HtmlData/>
    </TabPane>
      </Tabs>
    )
  }
}

export default Flowcenter;
